if exists (select name from sysobjects where name like 'Proc_ChiTietThe_Update')
	drop procedure Proc_ChiTietThe_Update
go

create PROC Proc_ChiTietThe_Update (@lockF int,@delF int , @maSoPin nchar (10))
as
	set tran isolation level read committed
	begin tran
		Update ChiTietThe
		set MaSoPin=@maSoPin, LockFlg=@lockF, DelFlg=@delF
		return 1
	waitfor delay '00:00:10'
go

------------------------
if exists (select name from sysobjects where name like 'Proc_ChiTietThe_View')
	drop procedure Proc_ChiTietThe_View
go

create PROC Proc_ChiTietThe_View
as
begin
select * from ChiTietThe
go
-------------------------

if exists (select name from sysobjects where name like 'Proc_ChiTietThe_KTMapin')
	drop procedure Proc_ChiTietThe_KTMapin
go

create PROC Proc_ChiTietThe_KTMapin (@maPin nvarchar(50), @maThe int)
as
set tran isolation level read committed
begin tran
	select * from ChiTietThe
	where MaSoPin = @maPin and MaThe = @maThe
commit tran
go